home *** CD-ROM | disk | FTP | other *** search
/ QuickTime VR Showcase / QuickTime VR Showcase.iso / 3rd Parties / Services / VRToolworks / others.Dxr / 00050.ls < prev    next >
Encoding:
Text File  |  1996-12-06  |  11.3 KB  |  378 lines

  1. on startMovie
  2.   global gPanoMovieID, gNavMovieID, gPathName, gLastTimeRollover, gPanoFrame, gQTVRCallBackFactory
  3.   set gPanoMovieID to EMPTY
  4.   set gNavMovieID to EMPTY
  5.   set gPathName to EMPTY
  6.   set gLastTimeRollover to 0
  7.   set gPanoFrame to EMPTY
  8.   openXLib("QuickTime VR XCMDs")
  9.   RegisterComponent(the pathName & "QuickTime VR Components", EMPTY)
  10.   set gQTVRCallBackFactory to CallBackTracer(mnew)
  11.   setCallBack(#PanoMovie, gQTVRCallBackFactory)
  12. end
  13.  
  14. on stopMovie
  15.   global gQTVRCallBackFactory
  16.   ClosePanoMovie()
  17.   CloseNavMovie()
  18.   closeXLib("QuickTime VR XCMDs")
  19.   if objectp(gQTVRCallBackFactory) then
  20.     gQTVRCallBackFactory(mdispose)
  21.   end if
  22. end
  23.  
  24. on OpenNavMovie pFilename, pSpriteNum, pShowOnOpen
  25.   global gNavMovieID
  26.   CloseNavMovie()
  27.   set tnavRect to the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum & "," & the right of sprite pSpriteNum & "," & the bottom of sprite pSpriteNum
  28.   put tnavRect
  29.   set gNavMovieID to NavMovie("openMovie", "Direct", pFilename, the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum, "ShowPoster", "Invisible")
  30.   if gNavMovieID contains "error" then
  31.     put gNavMovieID
  32.     set gNavMovieID to EMPTY
  33.     beep()
  34.     exit
  35.   end if
  36. end
  37.  
  38. on ShowNavMovie
  39.   global gNavMovieID
  40.   if gNavMovieID <> EMPTY then
  41.     NavMovie("Direct", gNavMovieID, "update")
  42.   end if
  43. end
  44.  
  45. on ZoomNavMovie pStartZoomRect, pSkipFirstFrame, pClipRect
  46.   global gNavMovieID
  47.   if gNavMovieID <> EMPTY then
  48.     set tCommand to "ZoomOutMovie" && QUOTE & pStartZoomRect & QUOTE
  49.     if not voidp(pSkipFirstFrame) then
  50.       set tCommand to tCommand & "," & pSkipFirstFrame
  51.     end if
  52.     if not voidp(pClipRect) then
  53.       set tCommand to tCommand & "," & QUOTE & pClipRect & QUOTE
  54.     end if
  55.     NavMovie("Direct", gNavMovieID, tCommand)
  56.     NavMovie("Direct", gNavMovieID, "idle")
  57.   end if
  58. end
  59.  
  60. on SetNavMovieView pHPan, pVPan
  61.   global gNavMovieID
  62.   if gNavMovieID <> EMPTY then
  63.     NavMovie("Direct", gNavMovieID, "set", "hPanAngle", pHPan)
  64.     NavMovie("Direct", gNavMovieID, "set", "vPanAngle", pVPan)
  65.   end if
  66. end
  67.  
  68. on CloseNavMovie
  69.   global gNavMovieID
  70.   if gNavMovieID <> EMPTY then
  71.     NavMovie("Direct", gNavMovieID, "dispose")
  72.     set gNavMovieID to EMPTY
  73.   end if
  74. end
  75.  
  76. on NavFrameScript pSpriteNum
  77.   global gNavMovieID
  78.   if (gNavMovieID <> EMPTY) and (RunningInForeground() = "true") then
  79.     if rollOver(pSpriteNum) then
  80.       NavMovie("Direct", gNavMovieID, "mouseOver")
  81.       cursor(200)
  82.       cursor(-1)
  83.     else
  84.       NavMovie("Direct", gNavMovieID, "idle")
  85.     end if
  86.   end if
  87. end
  88.  
  89. on OpenPanoMovie pFilename, pSpriteNum, pShowOnOpen
  90.   global gPanoMovieID, gPathName
  91.   ClosePanoMovie()
  92.   set tPanoRect to the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum & "," & the right of sprite pSpriteNum & "," & the bottom of sprite pSpriteNum
  93.   set gPanoMovieID to PanoMovie("openMovie", "Direct", pFilename, tPanoRect)
  94.   if gPanoMovieID contains "error" then
  95.     put gPanoMovieID
  96.     set gPanoMovieID to EMPTY
  97.     beep()
  98.     exit
  99.   end if
  100.   set gPathName to ExtractPathName(pFilename)
  101.   InitPanoCallbacks()
  102. end
  103.  
  104. on InitPanoCallbacks
  105.   global gPanoMovieID
  106.   if gPanoMovieID <> EMPTY then
  107.     PanoMovie("Direct", gPanoMovieID, "set", "mouseOverHandler", EMPTY)
  108.     PanoMovie("Direct", gPanoMovieID, "set", "rolloverHotSpotHandler", "sampleRolloverHandler")
  109.     PanoMovie("Direct", gPanoMovieID, "set", "mouseDownHandler", EMPTY)
  110.     PanoMovie("Direct", gPanoMovieID, "set", "panZoomStartHandler", EMPTY)
  111.     PanoMovie("Direct", gPanoMovieID, "set", "mouseStillDownHandler", EMPTY)
  112.     PanoMovie("Direct", gPanoMovieID, "set", "nodeLeaveHandler", EMPTY)
  113.   end if
  114. end
  115.  
  116. on ShowPanoMovie pQuality
  117.   global gPanoMovieID
  118.   if gPanoMovieID <> EMPTY then
  119.     if not voidp(pQuality) then
  120.       PanoMovie("Direct", gPanoMovieID, "set", "quality", pQuality)
  121.     end if
  122.     PanoMovie("Direct", gPanoMovieID, "update")
  123.   end if
  124. end
  125.  
  126. on SetPanoNode pNodeID, pUpdate, pQuality
  127.   global gPanoMovieID
  128.   if gPanoMovieID <> EMPTY then
  129.     PanoMovie("Direct", gPanoMovieID, "set", "nodeID", pNodeID)
  130.     if not voidp(pQuality) then
  131.       PanoMovie("Direct", gPanoMovieID, "set", "quality", pQuality)
  132.     end if
  133.     if pUpdate then
  134.       PanoMovie("Direct", gPanoMovieID, "Update")
  135.     end if
  136.   end if
  137. end
  138.  
  139. on SwingPanoMovie pHPan, pVPan, pZoom, pSwingSpeed, pSwingQuality, pFinalQuality
  140.   global gPanoMovieID
  141.   if gPanoMovieID <> EMPTY then
  142.     PanoMovie("Direct", gPanoMovieID, "set", "zoomAngle", pZoom)
  143.     PanoMovie("Direct", gPanoMovieID, "set", "vPanAngle", pVPan)
  144.     PanoMovie("Direct", gPanoMovieID, "set", "hPanAngle", pHPan)
  145.     PanoMovie("Direct", gPanoMovieID, "set", "quality", pSwingQuality)
  146.     PanoMovie("Direct", gPanoMovieID, "set", "transitionMode", "swing")
  147.     PanoMovie("Direct", gPanoMovieID, "set", "transitionSpeed", pSwingSpeed)
  148.     PanoMovie("Direct", gPanoMovieID, "update")
  149.     PanoMovie("Direct", gPanoMovieID, "set", "transitionMode", "normal")
  150.     if pFinalQuality <> pSwingQuality then
  151.       PanoMovie("Direct", gPanoMovieID, "set", "quality", pFinalQuality)
  152.       PanoMovie("Direct", gPanoMovieID, "update")
  153.     end if
  154.   end if
  155. end
  156.  
  157. on CollapsePanoMovie
  158.   global gPanoMovieID
  159.   if gPanoMovieID <> EMPTY then
  160.     PanoMovie("Direct", gPanoMovieID, "CollapseToHotSpotRgn")
  161.   end if
  162. end
  163.  
  164. on SetPanoMovieView pHPan, pVPan, pZoom, pQuality
  165.   global gPanoMovieID
  166.   if gPanoMovieID <> EMPTY then
  167.     PanoMovie("Direct", gPanoMovieID, "set", "zoomAngle", pZoom)
  168.     PanoMovie("Direct", gPanoMovieID, "set", "vPanAngle", pVPan)
  169.     PanoMovie("Direct", gPanoMovieID, "set", "hPanAngle", pHPan)
  170.     if not voidp(pQuality) then
  171.       PanoMovie("Direct", gPanoMovieID, "set", "quality", pQuality)
  172.     end if
  173.     PanoMovie("Direct", gPanoMovieID, "update")
  174.   end if
  175. end
  176.  
  177. on ClosePanoMovie
  178.   global gPanoMovieID
  179.   if gPanoMovieID <> EMPTY then
  180.     PanoMovie("Direct", gPanoMovieID, "dispose")
  181.     set gPanoMovieID to EMPTY
  182.   end if
  183. end
  184.  
  185. on PanoFrameScript pSpriteNum
  186.   global gLastTimeRollover, gPanoMovieID, gLastPanoMovieData, gPathName, gNavMovieID, gPanoFrame
  187.   if rollOver(pSpriteNum) then
  188.     if (gPanoMovieID <> EMPTY) and (RunningInForeground() = "true") then
  189.       PanoMovie("Direct", gPanoMovieID, "mouseOver")
  190.       set tMouseOverResult to the result
  191.       if tMouseOverResult <> 0 then
  192.         set tAction to item 1 of tMouseOverResult
  193.         if tAction = "jump" then
  194.           put item 2 of tMouseOverResult into field "Current Node ID"
  195.         else
  196.           if tAction = "stil" then
  197.             put item 2 of tMouseOverResult into field "Current Hot Spot ID"
  198.           else
  199.             if tAction = "navg" then
  200.               set tHotSpotID to item 2 of tMouseOverResult
  201.               put tHotSpotID into field "Current Hot Spot ID"
  202.               set tStartZoom to PanoMovie("Direct", gPanoMovieID, "get", "navgZoomRect")
  203.               set tViewAngles to PanoMovie("Direct", gPanoMovieID, "get", "navgViewAngles")
  204.               set tFileName to PanoMovie("Direct", gPanoMovieID, "get", "hotSpotName")
  205.               CollapsePanoMovie()
  206.               OpenNavMovie(gPathName & ":" & tFileName, 2, 0)
  207.               if gNavMovieID <> EMPTY then
  208.                 set gPanoFrame to marker(0)
  209.                 go("Object From Pano")
  210.                 SetNavMovieView(item 1 of tViewAngles, item 2 of tViewAngles)
  211.                 set tClipRect to the left of sprite 2 & "," & the top of sprite 2 & "," & the right of sprite 2 & "," & the bottom of sprite 2
  212.                 ZoomNavMovie(tStartZoom, "true", tClipRect)
  213.               else
  214.                 PanoMovie("Direct", gPanoMovieID, "update")
  215.               end if
  216.             else
  217.               if tAction = "misc" then
  218.                 put item 2 of tMouseOverResult into field "Current Hot Spot ID"
  219.               else
  220.                 if tAction = "undf" then
  221.                   put item 2 of tMouseOverResult into field "Current Hot Spot ID"
  222.                 else
  223.                   if tAction = "pan " then
  224.                   end if
  225.                 end if
  226.               end if
  227.             end if
  228.           end if
  229.         end if
  230.         set gLastTimeRollover to 1
  231.       else
  232.         if rollOver(pSpriteNum) then
  233.           set gLastTimeRollover to 1
  234.         else
  235.           cursor(200)
  236.           cursor(-1)
  237.           set gLastTimeRollover to 0
  238.         end if
  239.       end if
  240.     end if
  241.   else
  242.     if gLastTimeRollover then
  243.       cursor(200)
  244.       cursor(-1)
  245.       set gLastTimeRollover to 0
  246.       if gPanoMovieID <> EMPTY then
  247.         PanoMovie("Direct", gPanoMovieID, "idle")
  248.       end if
  249.     end if
  250.   end if
  251. end
  252.  
  253. on SampleMouseOverHandler
  254.   global gPanoMovieID
  255.   put "Mouse over panoramic movie"
  256.   if gPanoMovieID <> EMPTY then
  257.   end if
  258. end
  259.  
  260. on SampleRolloverHandler pHotSpotID
  261.   put pHotSpotID into field "Current Hot Spot ID"
  262. end
  263.  
  264. on SampleMouseDownHandler
  265.   global gPanoMovieID
  266.   put "Mouse down during mouseOver call"
  267.   if gPanoMovieID <> EMPTY then
  268.     PanoMovie("Direct", gPanoMovieID, "PassMouseDown")
  269.   end if
  270. end
  271.  
  272. on SamplePanZoomStartHandler
  273.   put "About to pan or zoom in panoramic movie"
  274. end
  275.  
  276. on SampleMouseStillDownHandler
  277.   global gPanoMovieID
  278.   put "Enter mouse still down from panoramic movie"
  279.   if gPanoMovieID <> EMPTY then
  280.   end if
  281.   put "Leave mouse still down from panoramic movie"
  282. end
  283.  
  284. on SampleNodeLeaveHandler pToNode
  285.   put "Jumping to node " & pToNode & " in panoramic movie"
  286. end
  287.  
  288. on ExtractPathName pPathName
  289.   set tDelimiter to ":"
  290.   if pPathName contains tDelimiter then
  291.     set tCharPos to length(pPathName)
  292.     repeat while tCharPos >= 1
  293.       if char tCharPos of pPathName = tDelimiter then
  294.         return char 1 to tCharPos - 1 of pPathName
  295.       end if
  296.       set tCharPos to tCharPos - 1
  297.     end repeat
  298.     return EMPTY
  299.   else
  300.     return EMPTY
  301.   end if
  302. end
  303.  
  304. on SetupHandler pHandlerName
  305.   global gPanoMovieID
  306.   if the hilite of cast (pHandlerName && "Check") then
  307.     PanoMovie("Direct", gPanoMovieID, "set", pHandlerName, "test" & pHandlerName)
  308.   else
  309.     PanoMovie("Direct", gPanoMovieID, "set", pHandlerName, EMPTY)
  310.   end if
  311. end
  312.  
  313. on TestMouseOverHandler
  314.   global gPanoMovieID
  315.   if gPanoMovieID <> EMPTY then
  316.     put "In mouse over at: " & the ticks into field "MouseOverHandler Message"
  317.   end if
  318. end
  319.  
  320. on TestRolloverHotSpotHandler pHotSpotID
  321.   global gPanoMovieID
  322.   if gPanoMovieID <> EMPTY then
  323.     put "Rolling over hot spot: " & pHotSpotID into field "RolloverHotSpotHandler Message"
  324.   end if
  325. end
  326.  
  327. on TestMouseDownHandler
  328.   global gPanoMovieID
  329.   if gPanoMovieID <> EMPTY then
  330.     put "In mouse down at: " & the ticks into field "MouseDownHandler Message"
  331.     PanoMovie("Direct", gPanoMovieID, "PassMouseDown")
  332.   end if
  333. end
  334.  
  335. on TestPanZoomStartHandler
  336.   global gPanoMovieID
  337.   if gPanoMovieID <> EMPTY then
  338.     put "In pan zoom start at: " & the ticks into field "PanZoomStartHandler Message"
  339.   end if
  340. end
  341.  
  342. on TestMouseStillDownHandler
  343.   global gPanoMovieID
  344.   if gPanoMovieID <> EMPTY then
  345.     put "In mouse still down at: " & the ticks into field "MouseStillDownHandler Message"
  346.     put PanoMovie("Direct", gPanoMovieID, "get", "hpanangle") into field "MouseStillDownHandler Message"
  347.   end if
  348. end
  349.  
  350. on TestNodeLeaveHandler pToNode
  351.   global gPanoMovieID
  352.   if gPanoMovieID <> EMPTY then
  353.     put "Leaving node ID: " & pToNode into field "NodeLeaveHandler Message"
  354.   end if
  355. end
  356.  
  357. factory CallBackTracer
  358. method mnew
  359.  
  360. method mEvalExpr pExpr
  361.  
  362. method mSendHCMessage pMessage
  363.  
  364. method mSendCardMessage pMessage
  365.   do(pMessage)
  366.  
  367. method mGetFieldByName pCard, pName
  368.  
  369. method mGetFieldByNum pCard, pNum
  370.  
  371. method mGetFieldByID pCard, pID
  372.  
  373. method mSetFieldByName pCard, pName, pValue
  374.  
  375. method mSetFieldByNum pCard, pNum, pValue
  376.  
  377. method mSetFieldByID pCard, pID, pValue
  378.